package com.simple.ds.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.simple.common.entity.po.Notify;
import com.simple.ds.mapper.NotifyMapper;
import com.simple.ds.service.NotifyService2;
import org.springframework.stereotype.Service;

/**
 * @author yasud
 * @date 2021年09月25日 14:15
 * @description
 */
@Service
public class NotifyService2Impl extends ServiceImpl<NotifyMapper, Notify> implements NotifyService2 {

    @Override
    public Notify save_(Notify notify) {
        save(notify);
        return notify;
    }

    @Override
    public Notify getNotifyByTradeNo(Long tradeNo) {
        QueryWrapper<Notify> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(Notify::getTradeNo, tradeNo);
        Notify notify = getOne(queryWrapper);
        return notify;
    }

    @Override
    public int countByTradeNo(Long tradeId) {
        QueryWrapper<Notify> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(Notify::getTradeNo, tradeId);
        return count(queryWrapper);
    }

    @Override
    public void updateById_(Notify notify) {
        updateById(notify);
    }
}
